/* Copyright (c) 2004-2024 peigen.info. All rights reserved. */

package info.peigen.hotpot.demo.repository.mapper;

import info.peigen.hotpot.common.core.enums.Currency;
import info.peigen.hotpot.component.data.repository.beetlsql.mapper.AbstractBeetlSqlMapper;
import info.peigen.hotpot.demo.repository.entity.AccountEntity;
import org.beetl.sql.mapper.annotation.Select;
import org.beetl.sql.mapper.annotation.Sql;
import org.beetl.sql.mapper.annotation.Update;

/**
 * <b>(AccountMapper)</b>
 * 后台 "账户表" 映射服务
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2023-07-22
 */
@SuppressWarnings("unused")
public interface AccountMapper extends AbstractBeetlSqlMapper<AccountEntity> {
    @Sql("SELECT * FROM account WHERE customer_id = ?")
    @Select
    AccountEntity findByCustomerId(String customerId);

    @Sql("DELETE FROM account WHERE customer_id = ?")
    @Update
    void deleteByCustomerId(String customerId);

    @Sql("SELECT * FROM account WHERE account_id = ?")
    @Select
    AccountEntity findByAccountId(String accountId);

    @Sql("DELETE FROM account WHERE account_id = ?")
    @Update
    void deleteByAccountId(String accountId);

    @Sql("SELECT * FROM account WHERE currency = ?")
    @Select
    AccountEntity findByCurrency(Currency currency);

    @Sql("DELETE FROM account WHERE currency = ?")
    @Update
    void deleteByCurrency(Currency currency);

    @Sql("SELECT * FROM account WHERE partner_id = ?")
    @Select
    AccountEntity findByPartnerId(String partnerId);

    @Sql("DELETE FROM account WHERE partner_id = ?")
    @Update
    void deleteByPartnerId(String partnerId);
}